package com.xinlong.controller;

import com.xinlong.entity.Permission;
import com.xinlong.service.IPermissionService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.servlet.ModelAndView;

import java.util.List;

@Controller
@RequestMapping("/permission")
public class Permissioncontroller {

    @Autowired
    IPermissionService iPermissionService;

    @RequestMapping("/findAll.do")
    public ModelAndView findAll(){
        ModelAndView mv=new ModelAndView();
        List<Permission> pe=iPermissionService.findAll();
        mv.addObject("permissionList",pe);
        mv.setViewName("pemission-list1");
        return mv;
    }

    @RequestMapping("/save.do")
    public String save(Permission role){
        iPermissionService.save(role);
        return "redirect:findAll.do";
    }
}
